<template>
	<!-- 分类导航区域 -->
	<view class="nav-list">
	   <view class="nav-item" v-for="(item, index) in navList" :key="index">
	     <image :src="item.image_src" class="nav-img"></image>
	   </view>
	   aaa
	</view>
</template>

<script>
	import { $http } from '@escook/request-miniprogram';
	export default {
		data() {
			return {
				name:'navbar',
				// 分类导航的数据列表
				navList:[]
			};
		},
		onLoad() {
			// 调用获取分类导航的数据
			this.getNavList()
		},
		methods:{
			// 获取分类导航的数据
			async getNavList(){
				const {data:res}=await uni.$http.get('/api/public/v1/home/catitems')
				if(res.meta.status!==200) return uni.$showMsg()
				this.navList=res.message
				console.log(this.navList)
			}
		}
	}
</script>

<style lang="scss">
.nav-list {
  display: flex;
  justify-content: space-around;
  margin: 15px 0;

  .nav-img {
    width: 128rpx;
    height: 140rpx;
  }
}
</style>
